﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Server.Search.Administration;

namespace Collaboris.SharePoint.Moss.Search
{
    [Serializable]    
    public class SearchRulesCollection : List<SearchRule>
    {
        #region Methods (3)

        // Public Methods (3) 
        public void AddAllContentSearchRule()
        {
            SearchRule searchRule = new SearchRule(RuleType.AllContentSearch);

            this.Add(searchRule);
        }

        public void AddPropertyQuerysearchRule(ScopeRuleFilterBehavior behaviour, string name, string value)
        {
            SearchRule searchRule = new SearchRule(RuleType.PropertyQuerySearch);

            searchRule.Behaviour = behaviour;
            searchRule.PropertyName = name;
            searchRule.Value = value;

            this.Add(searchRule);
        }

        public void AddUrlSearchRule(ScopeRuleFilterBehavior behaviour, UrlScopeRuleType urlType, string url)
        {
            SearchRule searchRule = new SearchRule(RuleType.UrlSearch);
            searchRule.Behaviour = behaviour;
            searchRule.UrlType = urlType;
            searchRule.Url = url;

            this.Add(searchRule);
        }
        #endregion Methods
    }
}
